<template>
	<view class="p-2 flex" @click="open">
		<image :src="item.cover" style="height: 150rpx; width: 150rpx;" class=" rounded "></image>
		<view class=" flex flex-column justify-between flex-1 ml-2">
			<view class="font-md">
				{{item.title}}
			</view>
			<view class="text-secondary">
				{{item.desc}}
			</view>
			<view class="text-secondary">
				<text class="mr-1">动态:{{item.news_count}}</text>
				<text>今日:{{item.today_count}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			item:Object,
			index:Number,
			choose:{
				type:Boolean,
				default:false
			}
		},
		methods:{
			open(){
				if(this.choose){
					uni.$emit('chooseTopic',{
						id:this.item.id,
						title:this.item.title
					})
					return uni.navigateBack({
						delta: 1
					});
				}
				uni.navigateTo({
					url: '../../pages/topic-detail/topic-detail?detail='+JSON.stringify(this.item),
				});
			}
		}
	}
</script>

<style>
</style>
